// Copyright (c) 2008 Matthew Johnson
// Licensed under the MIT License (see license.txt)
package actionml.animation {
	import flash.utils.Dictionary;
	public dynamic class RenderContext {
		private var _time:Number;
		private var _newRenderers:Dictionary;
		private var _postRenderTargetFunctions:Dictionary;
		private var _postRenderAllFunctions:Dictionary;
		public function initialize() {
			_time = new Date().getTime();
			_newRenderers = new Dictionary();
			_postRenderTargetFunctions = new Dictionary();
		}
		public function get time():Number {
			return _time;
		}
		public function initializeTarget() {
			_postRenderTargetFunctions = new Dictionary();
		}
		public function addTargetPostRenderFunction(f:Function) {
			_postRenderTargetFunctions[f] = true;
		}
		public function postRenderTarget(o:Object) {
			for (var f:Object in _postRenderTargetFunctions) {
				f["call"](null, o, this);
			}
			_postRenderTargetFunctions = new Dictionary();
		}
		public function addPostRenderAllFunction(f:Function) {
			_postRenderAllFunctions[f] = true;
		}
		public function postRenderAll() {
			for (var f:Object in _postRenderAllFunctions) {
				f["call"](null, this);
			}
		}
	}
}